﻿// Decompiled with JetBrains decompiler
// Type: UnityEngine.Windows.Speech.KeywordRecognizer
// Assembly: UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: E6AE6B5A-2752-4B07-9528-C8B77C62CE79
// Assembly location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.dll
// XML documentation location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.xml

using System;
using System.Collections.Generic;

#nullable disable
namespace UnityEngine.Windows.Speech
{
  /// <summary>
  ///   <para>KeywordRecognizer listens to speech input and attempts to match uttered phrases to a list of registered keywords.</para>
  /// </summary>
  public sealed class KeywordRecognizer : PhraseRecognizer
  {
    /// <summary>
    ///   <para>Returns the list of keywords which was supplied when the keyword recognizer was created.</para>
    /// </summary>
    public IEnumerable<string> Keywords { get; private set; }

    /// <summary>
    ///   <para>Create a KeywordRecognizer which listens to specified keywords with the specified minimum confidence.  Phrases under the specified minimum level will be ignored.</para>
    /// </summary>
    /// <param name="keywords">The keywords that the recognizer will listen to.</param>
    /// <param name="minimumConfidence">The minimum confidence level of speech recognition that the recognizer will accept.</param>
    public KeywordRecognizer(string[] keywords)
      : this(keywords, ConfidenceLevel.Medium)
    {
    }

    /// <summary>
    ///   <para>Create a KeywordRecognizer which listens to specified keywords with the specified minimum confidence.  Phrases under the specified minimum level will be ignored.</para>
    /// </summary>
    /// <param name="keywords">The keywords that the recognizer will listen to.</param>
    /// <param name="minimumConfidence">The minimum confidence level of speech recognition that the recognizer will accept.</param>
    public KeywordRecognizer(string[] keywords, ConfidenceLevel minimumConfidence)
    {
      if (keywords == null)
        throw new ArgumentNullException(nameof (keywords));
      int num = keywords.Length != 0 ? keywords.Length : throw new ArgumentException("At least one keyword must be specified.", nameof (keywords));
      for (int index = 0; index < num; ++index)
      {
        if (keywords[index] == null)
          throw new ArgumentNullException(string.Format("Keyword at index {0} is null.", (object) index));
      }
      this.Keywords = (IEnumerable<string>) keywords;
      this.m_Recognizer = PhraseRecognizer.CreateFromKeywords((object) this, keywords, minimumConfidence);
    }
  }
}
